<template>
  <view class="">
    <input
      type="text"
      placeholder="请输入新待办事项"
      v-model="inputValue"
      @keydown.enter="handleAdd"
    />
    <button
      type="default"
      size="mini"
      @click="handleAdd"
    >添加</button>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        inputValue: ''
      }
    },
    methods: {
      handleAdd() {
        console.log('添加：', this.inputValue)
        this.$store.commit('addTodoItem', {title: this.inputValue})
        this.inputValue = ''
      }
    }
  }
</script>

<style>
</style>
